#include "comm.hpp"

int main()
{
    key_t k = getkey();
    printf("0x%x\n",k);

    int shmid = getShm(k);
    printf("shmid : 0x%x\n",shmid);

    //挂接
    char* start = (char*)attachShm(shmid);
    printf("attach shm success! address start: %p\n", start);
    sleep(5);

    //使用shm
    //char buffer[MAX_SIZE];
    while(std::cin >> start)
    {
        printf("%d\n",std::time(0));
    };

    //去关联
    detachShm(start);
    printf("deattach shm success! address start: %p\n", start);
    sleep(5);

    return 0;
}